home *** CD-ROM | disk | FTP | other *** search
- // open the sized evaluation window (quiz or test)
- function openEvaluationWindow(xsWhich, xsFromWhere){
- var vsPathToEvalFolder = "";
- var macIESuffix = "";
- if (isWinIE()) { macIESuffix = "WinIE" };
- switch (xsFromWhere) {
- case "home":
- vsPathToEvalFolder = "../";
- break;
- case "navbar":
- vsPathToEvalFolder = "../";
- break;
- case "systemtoc":
- vsPathToEvalFolder = "../../../../";
- break;
- }
-
- voNewWin = window.open(vsPathToEvalFolder + "evaluation/" + xsWhich + macIESuffix + ".html", xsWhich, "toolbar=no,location=no,status=no,menubar=yes,scrollbars=no,width=618,height=415,resizable=no");
- voNewWin.focus();
- }
-
- // Detect if platform is Windows IE.
- function isWinIE() {
- var agt = navigator.userAgent.toLowerCase();
- var ie1 = (agt.indexOf("msie") != -1);
- var ie2 = (navigator.appName.toLowerCase().indexOf("microsoft") != -1);
- var mac1 = (agt.indexOf("mac")!=-1);
- var mac2 = (navigator.platform.toLowerCase().indexOf("mac") != -1);
- var isWin = (mac1 || mac2)? false : true;
- var test = ((ie1 || ie2) && (isWin) ? true : false);
- return test;
- }
-
- //////////// called from media onload
- // Set the prevbtns and the pull down in the toolbar and the navbar
- function setOtherFramesFromMediaPageOnLoad() {
- if(parent.navbar != null)
- setNextPrevBtns("images/");
-
- // set the pull-down
- if(parent.toolbar.document != null) {
- parent.toolbar.document.theForm.whichPageSelect.selectedIndex=eval(parent.gsPageNum) - 1;
- }
-
- // set the "return" button
- vsCurValue = getCookie("IPTrail");
- vsTrailLength = getNumberOfItemsFromDelimitedString(vsCurValue, ",");
-
- //alert("The TrailLength is " + vsTrailLength);
-
- // turn on the button if the trail length is 2 or more
- if(parent.navbar.document.images["return"] != null) {
- if(vsTrailLength >= 3) {
- // turn on the return button
- parent.navbar.document.images["return"].src = "images/return.gif";
- } else {
- parent.navbar.document.images["return"].src = "images/returngray.gif";
- }
- }
-
- }
-
- //////////// called from toolbar
- // reload the media frame with the page num in xsWhere (already a string)
- function goToPageInTopicFromToolbar(xsWhere) {
- parent.gsPageNum = xsWhere;
- vsNewURL = "../../../media.html?" + parent.gsSystem + "/" + parent.gsTopic + "/" + parent.gsPageNum;
- parent.content.location = vsNewURL;
- //alert("parent.gsPageNum = "+ xsWhere); //only called when toolbar is used
- }
-
-
- //////////// called from navbar
- // reload reload the media frame with the page num + xiWhere (which could be minus)
- function goToPageInTopicFromNavbar(xiWhere) {
- viCurPage = eval(parent.gsPageNum);
- viNewPage = viCurPage + xiWhere;
- viNumPagesInTopic = eval(parent.gsNumPagesInTopic);
-
- if(viNewPage > 0 && viNewPage <= viNumPagesInTopic) {
- parent.gsPageNum = padNumToXDigits(String(viNewPage), 2);
- vsNewURL = "media.html?" + parent.gsSystem + "/" + parent.gsTopic + "/" + parent.gsPageNum;
- parent.content.location = vsNewURL;
- //alert("parent.gsPageNum = "+ parent.gsPageNum); //only called from prev & next buttons
- }
- }
-
- // reloads and takes off a trail for the cookie
- function handleReplayBtnClick() {
- parent.content.location.reload();
-
- // strip off the last value, since we are about to add it back on
- vsCookieValue = getCookie("IPTrail");
-
- // take another off since the page you're going to will add itself to the cookie
- vsStrippedCookie = stripLastItemFromDelimitedString(vsCookieValue, ",");
-
- // reset the cookie with the last item off
- setCookie("IPTrail", vsStrippedCookie);
- }
-
- // NOT USED ANYMORE
- function writeTopicTocBtnHTML() {
- vsSystem = parent.gsSystem;
- document.write(" <a href='javascript:goToSpecificSystemTOC();'><img src='images/" +
- vsSystem + "toc.gif' border='0'></a>");
- }
-
- // reload the top with the system TOC (eg. respiratory/index.html)
- function goToSpecificSystemTOC() {
- vsNewURL = "systems/" + parent.gsSystem + "/index.html";
- top.location = vsNewURL;
- }
-
- // reload the whole frameset with new pages
- function goToQuizOrTopic() {
- if(topicIsQuizP(parent.gsTopic) == true) {
- vsTopic = getTopicNameFromQuizName(parent.gsTopic);
- vsNewURL = "buildframes.html?" + parent.gsSystem + "/" + vsTopic + "/01"
- top.location = vsNewURL;
- } else {
- // check if there is a quiz for this topic
- switch(parent.gsTopic) {
- case "heartrev":
- case "vsslrevw":
- case "orient":
- case "overview":
- alert("Sorry. No quiz exists for this topic.");
- break;
- default:
- vsNewURL = "buildframes.html?" + parent.gsSystem + "/" + parent.gsTopic + "q" + "/01";
- top.location = vsNewURL;
- }
- }
-
-
- }
-
- // write the html for the quiz btn (and set the link)
- function writeToQuizOrToTopicBtnHTML() {
- if(topicIsQuizP(parent.gsTopic) == true) {
- vsBtnSrc = "totopics";
- vsAltTag = "To Topic";
- } else {
- vsBtnSrc = "toquiz";
- vsAltTag = "To Quiz";
- }
-
- switch(parent.gsTopic) {
- case "heartrev":
- case "vsslrevw":
- case "orient":
- case "overview":
-
- case "biosec":
- case "acthorm":
- case "endorient":
- case "hormoneimb":
- case "hypoaxis":
- document.write("<img src='images/toquizgray.gif' ALT=''>");
- break;
- default:
- document.write(" <a href='javascript:goToQuizOrTopic();'><img src='images/" +
- vsBtnSrc + ".gif' border='0' ALT='" + vsAltTag + "'></a>");
- }
-
- }
-
- // strip the q off the end
- function getTopicNameFromQuizName(xsQuizName) {
- vsTopicName = xsQuizName.substring(0,xsQuizName.length - 1);
-
- return vsTopicName;
- }
-
- // see if q is the last letter of the topic. If so, Quiz
- function topicIsQuizP(xsTopic) {
- vsLastLetter = xsTopic.substring(xsTopic.length - 1, xsTopic.length);
-
- if(vsLastLetter == "q")
- vbIsQuiz = true;
- else
- vbIsQuiz = false;
-
- return vbIsQuiz;
- }
-
-
- /////////// called from media.html onload (setOtherFramesFromMediaPageOnLoad)
- // set the grayed out state and link of the next and prev btns
- function setNextPrevBtns(vsImagesFolderPath) {
- var vsPrevBtnSrc;
- var vsNextBtnSrc;
- var vsCurPageNum = parent.gsPageNum;
- var vsNumPagesInTopic = parent.gsNumPagesInTopic;
-
- // set prev btn
- if(vsCurPageNum == "01") {
- vsPrevBtnSrc = vsImagesFolderPath + "prevgray.gif";
- } else {
- vsPrevBtnSrc = vsImagesFolderPath + "prevup.gif";
- }
-
- // set next btn
- if(vsCurPageNum == vsNumPagesInTopic) {
- vsNextBtnSrc = vsImagesFolderPath + "nextgray.gif";
- } else {
- vsNextBtnSrc = vsImagesFolderPath + "nextup.gif";
- }
-
- if(parent.navbar.document.images["prevBtn"] != null &&
- parent.navbar.document.images["nextBtn"] != null) {
- parent.navbar.document.images["prevBtn"].src = vsPrevBtnSrc;
- parent.navbar.document.images["nextBtn"].src = vsNextBtnSrc;
- }
- }
-
- // Radio Btn Without Rollover
- function sndBtnClick(xsWhich, xsImagePath) {
- if(xsWhich!=selectedItem){
- // set some variables.
- vsOldSelectedItem = selectedItem;
- selectedItem = "none" // needed because "home" on is not the "roll" state.
-
- // turn the new one on
- changeImages(xsWhich, xsImagePath + xsWhich + "down.gif");
-
- // turn the old one off
- changeImages(vsOldSelectedItem, xsImagePath + vsOldSelectedItem + "up.gif");
-
- selectedItem = xsWhich;
-
- if(selectedItem=="yesnarr") {
- setIPSndCookie("true");
- if(window.location.href.indexOf("navbar")!=-1) {
- parent.gsNarrationOn = "narr"; // yup, string needed
- if(!topicIsQuizP(parent.gsTopic)) {
- goToPageInTopicFromNavbar(0);
- }
- }
- } else {
- setIPSndCookie("false");
- if(window.location.href.indexOf("navbar")!=-1) {
- parent.gsNarrationOn = ""; // yup, string needed
- if(!topicIsQuizP(parent.gsTopic)) {
- goToPageInTopicFromNavbar(0);
- }
- }
- }
- }
- }
-
- ///////////////////////////////////
- // SHARED
- // declares a new image
- function newImage(xsSrc) {
- if (document.images) {
- voTheImage = new Image();
- voTheImage.src = xsSrc;
- return voTheImage;
- }
- }
-
- // change the image xsImageName to the xsImageSrc
- function changeImages(xsImageName, xsImageSrc) {
- if (document.images && (preloadFlag == true)) {
- if(xsImageName != selectedItem && xsImageName!="none") {
- document.images[xsImageName].src = xsImageSrc;
- }
- }
- }
-
- function preloadImages() {
- if(document.images){
- //just used for preloading
- newImage("images/nonarrup.gif");
- newImage("images/nonarrdown.gif");
- newImage("images/yesnarrdown.gif");
- newImage("images/yesnarrup.gif");
- preloadFlag = true;
- }
- }
-
- /////////////////////////////////////
- // used in navbar.html and each topic menu - systems/systems/<system>/html/to.chtml
- function writeNarrationBtnHTML(xsImagePath) {
- vsNarrationOn = narrationOnP();
-
- // if no cookie was previously set, set it to true
- if(vsNarrationOn==null) {
- setIPSndCookie("true");
- vsNarrationOn = "true"; // yup, string.
- }
-
- // set the buttons by the value of vsNarration
- if(vsNarrationOn=="true") {
- vsYesBtnState = "down";
- vsNoBtnState = "up";
- selectedItem = "yesnarr";
- } else {
- vsYesBtnState = "up";
- vsNoBtnState = "down";
- selectedItem = "nonarr";
- }
-
- document.write("<nobr><A href='#' onclick='sndBtnClick(\"yesnarr\",\"" + xsImagePath + "\"); return false;'><IMG SRC='" + xsImagePath + "yesnarr" + vsYesBtnState + ".gif' name='yesnarr' ALT='Narration On' border='0'></a>");
- document.write("<A href='#' onclick='sndBtnClick(\"nonarr\",\"" + xsImagePath + "\"); return false;'><IMG SRC='" + xsImagePath + "nonarr" + vsNoBtnState + ".gif' name='nonarr' ALT='Narration Off' border='0'></a></nobr>");
- }
-
-
- ////////////////////
- // Used in glossary
- function glossaryDone() {
- vsNewURL = "../systems/media.html?" + top.gsSystem + "/" + top.gsTopic + "/" + top.gsPageNum;
-
- top.content.location = vsNewURL;
- }
-